package com.cloudkinto.bo.order.outbound;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 异常件确认
 *
 * @author long
 */
@Data
public class ExceptionConfirmBo {

    @ApiModelProperty("id")
    @NotNull(message = "id不可为空")
    private Long id;

    @ApiModelProperty("异常原因")
    @NotEmpty(message = "异常原因不可为空")
    private String exceptionReason;


    public String getExceptionReason() {
        if (StringUtils.isNotBlank(exceptionReason) && exceptionReason.length() > 100) {
            return exceptionReason.substring(0, 100);
        }
        return exceptionReason;
    }
}
